﻿Imports System.Windows.Markup

<MarkupExtensionReturnType(GetType(Object()))>
Public Class EnumValuesExtension
    Inherits MarkupExtension

    Public Sub New()

    End Sub
    Public Sub New(enumType As Type)
        Me.EnumType = enumType
    End Sub

    <ConstructorArgument("enumType")>
    Public Property EnumType As Type

    Public Overrides Function ProvideValue(serviceProvider As IServiceProvider) As Object
        If EnumType Is Nothing Then
            Throw New ArgumentException("EnumType is not set")
        End If
        Return [Enum].GetValues(EnumType)
    End Function
End Class
